<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div>
    <p>这是个p标签</p>
    </div>
    <script>
        // let p = document.querySelector('p')
        let p = document.getElementsByTagName('p')[0]
        let div = document.getElementsByTagName('div')[0]
        console.log(p);
        // 创建元素
        let h1 = document.createElement('h1')
        h1.innerHTML='标题标签'

        // 父元素.replaceChild(新元素，被替换的元素0)
        div.replaceChild(h1,p)

    </script>
</body>
</html>